package com.neusoft.service.impl;

import com.neusoft.mapper.DrugInfoDtoMapper;
import com.neusoft.service.DrugInfoDtoService;
import com.neusoft.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author akemihomurasama
 */
@Service
public class DrugInfoDtoServiceImpl implements DrugInfoDtoService {
    @Autowired
    private DrugInfoDtoMapper drugInfoDtoMapper;

    /**
     * 根据患者id和处方状态查询药品信息和处方id
     *
     * @param registerId 患者id
     * @param drugState  处方状态
     * @return 药品信息
     */
    @Override
    public Result queryDrugWithPrescriptionId(int registerId, String drugState) {
        return Result.ok(drugInfoDtoMapper.queryDrugWithPrescriptionId(registerId, drugState));
    }

    /**
     * 根据患者id查询药品信息并携带处方状态
     *
     * @param registerId 患者id
     * @return 查询结果
     */
    @Override
    public Result queryDrugWithState(int registerId) {
        return Result.ok(drugInfoDtoMapper.queryDrugWithState(registerId));
    }
}
